//Console output
#include <iostream>

#include "Window.h"
#include "../Math/Size.h"

//OpenGL Utility Library
#include "GLUT.h"

using namespace Graphics;

/** Creates a window with a given width, height. By default, fullscreen is off. */
Window::Window(Size s, std::string t, bool f)
{
	std::cout<< "Initializing a Graphics Window (" << s.width() << "x" << s.height() << ")" << std::endl;
	setSize(s);
	setTitle(t);
	_fullscreen=f;
	_handle=-1;

	//Create the window
	create();
}

void Window::create()
{
	glutInitWindowSize((int)_size.width(), (int)_size.height());
	_handle=glutCreateWindow(_title.c_str());
}

/**********
* GETTERS *
**********/

std::string Window::title()
{
	return _title;
}

bool Window::fullscreen()
{
	return _fullscreen;
}

int Window::handle()
{
	return _handle;
}

Size Window::size()
{
	return _size;
}

/**********
* SETTERS *
**********/

void Window::setSize(Size s)
{
	_size=s;
}

void Window::setSize(int width, int height)
{
	_size=Size((float)width, (float)height);
}

void Window::setTitle(std::string title)
{
	_title=title;
}

void Window::setFullscreen(bool fullscreen)
{
	_fullscreen=fullscreen;
}

void Window::setHandle(int handle)
{
	_handle=handle;
}
